using UnityEngine;
using System.Collections;

public class Carousel: MonoBehaviour
{
	// Update is called once per frame
	void FixedUpdate ()
    {
        const float speed = 150.0f;
		Quaternion deltaRotation = Quaternion.Euler(new Vector3(0.0f, Time.deltaTime*speed, 0.0f));
		rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);
	}

    public void init()
    {
        //return;
        HingeJoint joint = gameObject.AddComponent<HingeJoint>();
        joint.anchor = new Vector3(0, 0, 0);
        joint.axis = new Vector3(0, 1, 0);

        //gameObject.AddComponent<HingeJoint>();
        //JointLimits limits = new JointLimits();
        //limits.min = 0;
        //limits.max = 37;
        //joint.limits = limits;
    }
}
